package top.zsc.cloud.demo.system.controller;

import org.springframework.web.bind.annotation.*;
import top.zsc.cloud.demo.system.po.Dept;
import top.zsc.cloud.demo.system.service.DeptService;

import javax.annotation.Resource;
import java.util.List;

@RequestMapping("dept")
@RestController

public class DeptController {
    @Resource
    private DeptService deptService;


    @PostMapping("insert")
    public int insert(Dept dept) throws Exception {
        return deptService.insert(dept);
    }

    @PostMapping("update")
    public int update(@RequestBody Dept dept) throws Exception {
        return deptService.update(dept);
    }

    @GetMapping("selectAll")
    public List<Dept> selectAll() throws Exception {
        return deptService.selectAll();
    }

    @PostMapping("selectByDept")
    public List<Dept> selectByDept(@RequestBody Dept dept) throws Exception {
        return deptService.selectByDept(dept);
    }

    @GetMapping("selectByPk/{deptId}")
    public Dept selectByPk(@PathVariable Integer deptId) throws Exception {
        return deptService.selectByPk(deptId);
    }

}
